package zy.blogs.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zy.blogs.entity.SysUser;
import zy.blogs.mapper.SysUserMapper;

import java.util.List;

@Service
public class SysUserService extends ServiceImpl<SysUserMapper,SysUser> {
    SysUserMapper mapper;
    @Autowired
    public SysUserService(SysUserMapper mapper){
        this.mapper=mapper;
    }

    public List<SysUser> getAll() {
        List<SysUser> list=mapper.selectList(null);
        return list;
    }
    public SysUser getById(Long id){
        SysUser entity=mapper.selectById(id);
        return entity;
    }
    public boolean insert(SysUser entity){
        int result=mapper.deleteById(entity);
        return result>0?true: false;

    }
    public boolean update(SysUser entity) {
        int result=mapper.deleteById(entity);
        return result>0?true: false;
    }
    public boolean delete(Long id) {
        int result=mapper.deleteById(id);
        return result>0?true: false;
    }
    public String getSalt() {
        return null;
    }
    public String encryptPassword(String password, String salt) {
        return null;
    }
    public boolean validatePassword(String password, String encryptPassword, String salt) {
        return false;
    }
}
